package com.example.goods.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

@Mapper
public interface OrdersMapper {

    @Insert("insert into orders(order_id,user_id,art_id,unit_price,number,remarks,create_time) value " +
            "(#{order_id},#{user_id},#{art_id},#{unit_price},#{number},#{remarks},#{create_time})")
    int addOrders(@Param("user_id") String userId, @Param("order_id") String orderId, @Param("art_id") String artId,
                  @Param("unit_price") String unitPrice, @Param("number") int number, @Param("remarks") String remarks,
                  @Param("create_time") String createTime);


    @Select("select order_id,user_id,art_id,unit_price,number,status,remarks,create_time from orders where user_id = #{user_id}")
    IPage<Map<String, Object>> selectOrders(IPage<Map<String, Object>> page, @Param("user_id") String userId);
}
